home *** CD-ROM | disk | FTP | other *** search
- This QuickStart document provides a brief overview of some of the
- commands available in BBEdit Lite. For more general information about
- BBEdit Lite, consult the "About BBEdit Lite" document.
-
- The topics covered in this document are:
-
- * Installation
- * Editing Documents
- - Key Equivalents
- * More on Wrapping
- * Searching
- * Parting Shots
-
- ---
-
- Installation
- ============
-
- BBEdit•od Lite requires version 1.1 or later of OpenDoc.
-
- The distribution package consists of the following major components:
-
- * The "BBEdit•od Lite" component
- * The "MercutioPlugIn" component
- * The "BBEdit•od Lite 1.0" stationery file
-
- Place the “MercutioPlugIn” file into the “OpenDoc Shell Plug-Ins”
- folder. This folder may be found in the “OpenDoc” folder, which in turn
- resides in the “Editors” folder in your active system folder.
-
- Place the “BBEdit•od Lite” file (which is the OpenDoc part itself) in
- the “Editors” folder, which resides in your active System Folder.
-
- Place the “BBEdit•od Lite 1.0” stationery file in the “Stationery”
- folder which is at the top level of your startup disk.
-
- If you would like to use BBEdit extensions with BBEdit•od Lite, then
- make an alias to an existing “BBEdit Extensions” folder, and place the
- alias in your active system folder.
-
- Please be aware that, due to constraints inherent to OpenDoc and the
- BBEdit extension architecture, not all BBEdit extensions are compatible
- with BBEdit Lite for OpenDoc. In particular, it is not possible to use
- the HTML Tools which are included with the commercial version of BBEdit
- in this manner.
-
- From this point, you may use standard OpenDoc techniques to embed
- BBEdit•od Lite content in your existing OpenDoc documents, or to create
- new BBEdit•od Lite documents.
-
- ---
-
- Editing Documents
- ======= =========
-
- In terms of its basic editing functionality, BBEdit Lite behaves like
- any other word processor or text editor on the Macintosh: any typed
- characters are inserted at the insertion point; if there is a selection
- present, the selection is replaced by the first typed character, and the
- insertion point is placed after the first typed character.
-
- The insertion point is indicated by a blinking vertical bar.
-
- If there is any text selected in the active (or front) window, it is
- highlighted using your Mac's default highlight color. If there is text
- selected in a window that is inactive (not the front window), it is
- framed in the highlight color.
-
- As you type, BBEdit Lite scrolls the window's contents so that the
- insertion point is visible. Unless you have the "Soft Wrap Text" option
- selected, the window may scroll horizontally as you type.
-
- To move text from one place to another, select the text you wish to
- move, and choose the "Cut" command from the Edit menu. The selected text
- will be deleted, and placed in a special area called the "Clipboard".
- (The Clipboard always contains the last text that you cut or copied.)
- You can then use the "Paste" command on the Edit menu to place the text
- elsewhere in the document you are editing, or even in another window
- altogether. Also, any text that you cut or copy can be pasted into
- another application. You can place text in the Clipboard without
- deleting it by choosing "Copy" from the Edit menu.
-
- When you Paste, the text that's in the Clipboard will replace the
- current selection (if there is one), or be inserted at the insertion
- point. Paste doesn't remove text from the Clipboard, so you can Paste as
- many times as you wish.
-
- To delete selected text, hit the "Delete" key on your keyboard, or
- choose "Clear" from the Edit menu. If you have a keyboard with a numeric
- keypad on it, you can hit the "Clear" key on the keypad to delete the
- selected text.
-
- To select all the text in the front editing window, choose "Select All"
- from the Edit menu. You can then cut, copy, or perform any other action
- that affects selected text.
-
- BBEdit Lite provides an assortment of facilities for transforming text
- in various ways. The commands to transform text are all found under the
- Text menu:
-
- * Balance locates the pair of parentheses, braces, or brackets which
- encloses the current selection range or insertion point. If there
- are unmatched parentheses, braces, or brackets, BBEdit Lite will
- beep.
-
- * Change Case... allows you to automatically switch between upper and
- lower case characters for entire words, first letters of words, or
- first letters of lines.
-
- * Shift Left and Shift Right indent the selected text by one tab stop
- (in the case of Shift Left), or outdent by one tab stop (for Shift
- Right).
-
- * The Hard Wrap... command is used for wrapping long lines of text and
- filling paragraphs. Essentially, it uses carriage returns to break
- lines of text, to keep them from running off to the right of your
- screen.
-
- * Unwrap removes carriage returns and spaces between groups of
- text. Essentially, it performs the reverse function of the "Hard
- Wrap..." command.
-
- * Zap Gremlins... is useful for finding and altering or removing
- non-printing characters in your text files.
-
- * Entab converts runs of spaces into tabs, according to the current
- setting in the "Font and Tabs..." dialog. This transformation is
- useful when downloading text from a mainframe computer or on-line
- service which uses spaces to line up columns of text; when
- displaying the text in a monospaced font, columns will still usually
- not line up unless you Entab the text.
-
- * Detab converts tabs into runs of spaces, according to the current
- setting in the "Font and Tabs..." dialog. This is useful when
- uploading text to a mainframe or on-line service which has no
- concept of tabs as column separators.
-
-
- Cursor Key Equivalents:
-
- Sometimes, you may find prefer to do word selection or deletion
- directly from the keyboard. Here are some available shortcuts:
-
- Key Modifier Action
- --- -------- ------
- (left/right) Arrow (none) Move 1 character left/right
-
- (left/right) Arrow Option Move 1 word left/right
-
- (left/right) Arrow Command Move to beginning/end of line
-
- (up/down) Arrow (none) Move up/down 1 line in file
-
- (up/down) Arrow Option Move to previous/next screen page
-
- (up/down) Arrow Command Move to top/bottom of file
-
- [any of the above] Shift Make or extend a selection range
-
- Delete (none) Deletes characters backward
- (toward beginning of line)
-
- Delete Option Deletes words backward
- (toward beginning of line)
-
- Delete Command Deletes all characters from
- beginning of line containing
- selection range to end of selection
- range
-
- Special Keys:
-
- The Apple Extended Keyboard has additional function keys on it, which are
- usable within BBEdit Lite:
-
- Key Action
- --- ------
- F1 Undo
-
- F2 Cut
-
- F3 Copy
-
- F4 Paste
-
- "del" Forward Delete
-
- Home/End Scroll to start/end of document
-
- Cmd-Home/End Move insertion point to start/end of document
-
- Page Up/Down Scroll up/down a page
-
-
- ---
-
- More on Wrapping
- ==== == ========
-
- For composing text in situations where carriage returns are used as line
- separators (rather than paragraph separators), "hard" text wrapping is
- useful for formatting your text.
-
- To hard-wrap text in the current document window, choose "Hard Wrap..."
- from the Text menu.
-
- The settings on the left half of the "Hard Wrap..." dialog box control
- how much of the text is wrapped, and the maximum length of the lines
- after wrapping.
-
- The group of radio buttons controls the length of lines after they have
- been wrapped:
-
- * The "Philip Bar" button will break lines of text at the philip bar.
- (To see the location of the philip bar, turn on "Show Philip Bar" in the
- Windows section of the Preferences dialog.) The philip bar indicates the
- maximum usable width of a document window when the window is zoomed to
- full size on a nine-inch "classic" Macintosh screen. For this reason,
- you are guaranteed that text wrapped to the philip bar will be readable
- without horizontal scrolling by anyone on any Macintosh.
-
- * If "Window Width" is selected, no wrapped line will be longer than
- the current width of the window. This option is useful if you'd like the
- lines to be a little longer or a little shorter than is provided for by
- the philip bar; just size the window appropriately and wrap.
-
- * If "Character Width" is selected, the number in the text field
- designates the maximum number of characters allowed on any line; a line
- that exceeds this number of characters in length will be wrapped. The
- "Character Width" setting is useful for preparing postings to on-line
- services, which can break lines in an unattractive fashion if they're
- longer than a fixed number of characters (usually 78 to 80).
-
- The controls on the right half of the dialog control paragraph wrapping.
- If the "Paragraph Fill" check box is turned off, long lines will be
- wrapped. Short lines will be left untouched.
-
- ---
-
- Searching
- =========
-
- BBEdit Lite gives you the ability to search for strings of characters
- within the current document. When you choose "Find..." from the Search
- menu, BBEdit Lite will present a dialog box with several options.
-
- The edit field to the right of "Search For:" contains the string of
- characters that you wish to search for. This string will be used as it
- is displayed if the "Literal" button at the top of the dialog is chosen.
- literal characters, If the "Grep" button has been selected, the string
- in this edit field is a regular expression. See the section below for
- more information on grep searching.
-
- The edit field to the right of "Replace With:" contains the string of
- characters that will replace the current selection whenever you choose
- "Replace", "Replace and Find Again", or "Replace All" from the Search
- menu.
-
- Note: To search for an explicit carriage return, line feed, or tab, you
- can type the literal character by holding down the Command key and
- hitting the Return or Tab key, or typing "\n" for a line feed, "\r" for
- a carriage return, or "\t" for a tab. You can also type Control-J,
- Control-M, and Control-I, respectively. To search for a -literal-
- occurrence of an escape (for example, in C or Rez program source), use
- two backslashes: "\\n", "\\r", and "\\t". Also, a "\\" will be
- interpreted to mean a single backslash, just as it does in C.
-
- The "Match Case" check box determines whether the search is
- case-sensitive or not. If "Match Case" is checked, only text which has
- the same combination of upper and lower case letters as the Search For
- string will be found.
-
- The "Entire Word" check box determines whether the text being searched
- must be bounded by word breaks (spaces, dashes, and other punctuation).
-
- The "Start at Top" check box will cause the entire document to be
- searched, starting at the beginning of the document and proceeding
- forward to the end of the document.
-
- The "Wrap Around" check box will cause the entire document to be
- searched, regardless of where the current insertion point or selection
- range lies. Ordinarily, only the text from the start of the selection
- range to the end of the document is searched. If "Wrap Around" is turned
- on, and the search string isn't found between the start of the selection
- range and the end of the document, the search will automatically restart
- from the beginning of the document. If the search string is found in the
- document after wrapping around, BBEdit Lite will blink the menu bar to alert
- you.
-
- If the "Search Backwards" check box is checked, BBEdit Lite will search
- backwards from the start of the insertion point to the start of the
- document, rather than forward to the end of the document. If "Wrap
- Around" is checked, and the search string is not found between the start
- of the document and the start of the selection range, the backwards
- search will resume from the end of the document.
-
- If the "Selection Only" check box is checked, BBEdit Lite will search only the
- selected range of text.
-
- Note: If "Start at Top" is checked, the "Search Backwards", "Selection
- Only", and "Wrap Around" options are automatically disabled.
-
- After you have entered the search and replace strings and set the search
- options appropriately, you can click any of the buttons arrayed along
- the right-hand edge of the dialog:
-
- - If you click "Find", BBEdit Lite will search for the current search
- string, using the current search options.
-
- - If you click "Replace", BBEdit Lite will search for the next occurrence
- of the search string, using the current search options, and replace
- it with the specified replace string.
-
- - If you click "Replace All", BBEdit Lite will locate all occurrences of
- the search string, and replace them with the specified replace
- string.
-
- - If you click "Don't Find", BBEdit Lite will accept the current search
- strings and options, but will not perform the search; you can then
- choose "Find Again" from the Search menu to start the search.
-
- ---
-
- Grep Searching
-
- Grep is a method of pattern matching that derives from the Unix(TM)
- operating system. You are probably familiar with simple pattern
- matching from using word processors; when you ask a word processor to
- find all instances of the word "black", it is performing a simple
- pattern match, where each letter has to match literally. Matching
- strings in this manner is not very hard.
-
- The ability to match strings in a more general manner is both more
- powerful and more complicated. It allows for sophisticated pattern
- matching operations, such as matching all words that begin with the
- letter "P" and end with the letters "er", or deleting the first word of
- every line. Grep provides a powerful means of doing this.
-
- To use Grep for searching documents, just select the "Grep" button in
- the Find... dialog.
-
- The popup menu next to the "Patterns:" in the dialog contains a list of
- your most commonly-used Grep patterns. You can change this list in the
- "Grep Patterns" section of the Preferences... dialog.
-
-
- How Grep Works
-
- The "grep" mode of searching and replacing is a powerful tool. Although
- somewhat slower than normal text searching, grep allows the user to
- search for one of a set of many strings instead of a particular string.
- As a simple example, you can search for any occurrence of an identifier
- beginning with the letter P, or all lines that begin with a left brace.
-
- A pattern is a group of characters which in turn describe a particular
- set of strings. These strings are also composed of characters, which may
- be anything from ordinary letters or numbers to control characters. For
- example, there is a set of strings which begin with the letter P and end
- with the letter r; the strings "Ptr" and "ProcPtr" are two members of
- this set (though there are also many others).
-
- In just the same manner, there is a set of strings which consists of the
- number 1 followed by a space, then a three-letter word, and ending with
- a carriage return. Strings such as "1 bat\r" and "9 top\r" would be
- members of this set. Please note the use of "\r" to denote a carriage
- return, as explained in the previous section.
-
- We say that a string is matched by a pattern if it is a member of the
- set described by the pattern. Patterns are composed of sub-patterns
- which are patterns in themselves; this is how complicated patterns may
- be formed.
-
- The following section describes the rules used for grep pattern matching
- and replacement step by step. By learning these rules, and working
- through some examples you should be able to understand how each of the
- elements of a grep patterns works and be able to make your own.
-
- In some instances, the 'Case Sensitive' option will affect the results
- of a pattern match. We have noted below when this is the case.
-
-
- Grep Pattern Rules
-
- 1. Any character, with certain exceptions described below, is a pattern
- that matches itself.
-
- 2. A pattern x followed by a pattern y forms a pattern xy that matches
- any string Bu where B can be matched by x and u can be matched by y. We
- can, of course, take the compound pattern xy and concatenate yet another
- pattern z onto it, forming the pattern xyz.
-
- 3. The character . is a pattern that will match any character.
-
- 4. The character \ followed by any character except one of the digits
- 1-9 is a pattern that matches that character. (You would use this to
- find special characters, such as the . character. To search for a
- period, you would use \.).
-
- 5. A string of characters s surrounded by square brackets ([ and a ])
- forms a pattern [s] that matches a single instance of one of the
- characters in the string s. Note that the case sensitivity flag does
- not apply to characters between square brackets: letters must match
- exactly.
-
- 5a. The pattern [^B] matches any character that is not in the string
- B. Special characters will be taken literally in this context. Again,
- case sensitivity doesn't apply to characters between square brackets.
-
- 5b. If a string of three characters in the form [a-b] occurs in the
- pattern p, this represents all of the characters from a to b inclusive.
- All special characters are taken literally; i.e., [!-.] denotes the
- characters from ! to .. Notice that the only way to include the
- character ] in p is to make it the very first character. Likewise, the
- only way to include the character - in p is to have it either at the
- very beginning or the very end of p. Single characters and ranges may
- both be used between brackets.
-
- 6a. Any pattern p formed by any combination of rules 1 or 3-5b
- followed by a * forms the pattern p* that matches zero or more
- consecutive occurrences of characters matched by p.
-
- 6c. Any pattern p formed by any combination of rules 1 or 3-5b
- followed by a ? forms the pattern p? that matches zero or one
- consecutive occurrences of characters matched by p.
-
- We now have the ability to form patterns that are composed of
- sub-patterns, and will find it useful to "remember" sub-strings matched
- by sub-patterns and to be able to match against those substrings.
-
- 7. A pattern surrounded by ( and ) is a pattern that matches whatever
- the sub-pattern matches. This is useful for matching two or more
- instances of the same string and when doing replacements.
-
- Sometimes it is useful to be able to "constrain" patterns to match only if
- certain conditions in the context outside the string matched are met.
-
- 8. A pattern p that is preceded by a ^ forms a pattern ^p. If the
- pattern ^p is not preceded by any other pattern, it matches whatever p
- matches as long as the first character matched by p occurs at the
- beginning of a line. If the pattern ^p is preceded by another pattern,
- then the ^ is taken literally.
-
- 9. A pattern p that is followed by a $ forms a pattern p$. If the
- pattern p$ is not followed by any other pattern, it matches whatever p
- matches as long as the last character matched by p occurs at the end of
- a line. If the pattern p$ is followed by another pattern, then the $ is
- taken literally.
-
- Note that the characters ^ and $ constrain pattern matches to begin or
- end at line boundaries, and so can be combined to constrain a pattern to
- match an entire line only (as in the above example).
-
- Grep provides not only a more sophisticated method of searching, but a
- sophisticated method of replacing as well. In a replacement string, the
- following substitutions are made before any text replacement occurs:
-
- 1. Each occurrence of the character & is replaced with whatever was
- last matched by the entire pattern.
-
- 2. Each occurrence of a string of the form \n, where n is one of the
- digits 1-9, is replaced by whatever was last matched by the sub-pattern
- beginning with the nth occurrence of (.
-
- 3. Each occurrence of a string of the form \p, where p is other than
- one of the digits 1-9, is replaced by p.
-
- This allows you to not only be able to search for a string satisfying a
- complex set of conditions, but also to be able to do a subsequent
- replacement that varies depending on the string that is matched. Note
- that this does not take into account escape sequences, such as \t,
- \r, \n, \\, etc.
-
- Example 1:
-
- Suppose that you have written a program that is to become a Macintosh
- application (i.e., it uses the Macintosh ToolBox instead of stdio for
- the user interface). Suppose also that you have discovered that you
- have forgotten to put a \p at the beginning of your string constants, so
- that your program is trying to pass C strings instead of Pascal strings
- to the Toolbox (which only knows how to deal with Pascal strings).
-
- You can easily change all your C strings to Pascal strings as follows:
-
- search for: "(.*)"
-
- replace with: "\\p\1"
-
- This works by locating a pair of parentheses (your C string contents),
- and matching their contents as part of a subpattern, i.e. locating zero
- or more instances of any character which is contained within a pair of
- double quotes. The replacement operation then specifies that you start
- with another pair of double quotes, and within them, place the \p
- followed by the contents of the last subpattern match, which in this
- case consists of the C string contents. The extra leading backslash
- ensures that the backslash character immediately preceding the \p is
- inserted literally.
-
- Example 2:
-
- Suppose you decided to reverse the two arguments of the function
- "foo". You might try foo\(([^,]*),([^)]*)\) as the search pattern
- and foo(\2, \1) as the replacement pattern. How does the search
- pattern work?
-
- Let's assume we're trying to match some text that looks like write(1,*bar)
-
- foo\(([^,]*),([^)]*)\) matches foo(1,*bar)
-
- Since ([^,]*) matched 1 and ([^)]*) matched *bar, the two arguments to
- foo, the replacement pattern foo(\2, \1) will result in foo(*bar, 1)
-
- This, unfortunately, won't work in the case of foo(1,(*bar)+2), since
- ([^)]*) will match only up to the first right parenthesis, leaving +2)
- unmatched. If we're sure that all calls to foo end with a semicolon,
- however, we can change our pattern to foo\(([^,]*),([^;]*)\);. In this
- pattern, instead of trying to match the second argument by matching
- everything up to the first right parenthesis, we match everything up to
- the ); which terminates the invocation of foo.
-
-
- Example 3:
-
- Suppose that you are trying to remove all of the HTML tags for bold text
- from a given document, or any part of one. The recipe by which bold tags
- work is simply to insert the opening tag <B> and the closing tag </B>
- around the text which you wish to appear in bold.
-
- So long as both tags are on the same line, it is fairly simple to
- accomplish such a task. (If they are on different lines, you must know
- how many intervening line breaks there are between the opening and
- closing tags, because the grep engine cannot handle an indefinite set of
- line breaks.) So, you can do something like this
-
- search for: <B>(.*)</B>
-
- replace with: \1
-
- where <B> matches the opening tag and </B> matches the closing tag.
- Between these tags are a pair of parentheses which mark the use of a
- sub-pattern, containing a set of zero or more instances of any
- character(s), so that you can also remove a blank pair of tags. The \1
- in the replace field indicates that the contents of the first (and in
- this case only) subpattern match will be inserted back into the document
- in place of the original found string.
-
-
- Using Subpatterns
-
- In two of these examples, we show how to analyze a grep pattern by
- examining sub-patterns. This is a good way of figuring out how to build
- a pattern as well. Grep can be thought of as a small programming
- language, with each pattern a program and sub-pattern a statement in
- this language. If you try to create a grep pattern by testing a small
- sub-pattern, then adding and testing additional sub-patterns until the
- complete pattern is built, you may find building complex grep patterns
- not nearly as daunting as you first thought.
-
- ---
- Parting Shots
-
- Be sure to read the "BBEdit•od Lite Info" document which comes with the
- BBEdit•od Lite software package for complete information on the license
- requirements and other details. If you wish to get in touch with us for
- any reason, here's how:
-
- Postal: Bare Bones Software, Inc.
- P.O. Box 1048
- Bedford, MA 01730-1048
-
- Web page: http://www.barebones.com/
-
- Email: bbsw@barebones.com
-
- Phone: +1 617 778 3100
- Fax: +1 617 778 3111
-
- Please note that we cannot provide technical support for BBEdit Lite or
- our other freeware products via phone or fax; however, if you contact us
- via email, we will be happy to assist you.
-
- =============================================================================
- All products mentioned are trademarks or registered trademarks of their
- respective holders.
-
- This document is written by and copyright (c)1995-1996 by Bare Bones Software,
- Inc. It may be redistributed freely as long as it is not modified in any
- way. Information presented here is accurate as of the time of writing, but
- is subject to change without notice.
-
- BBEdit Lite is copyright (c)1992-1996 Bare Bones Software, Inc., all
- rights reserved. Please see the enclosed informational material for
- license requirements.
-
- =end=
-